home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’94
/
[√] May be freely distributed
/
Tom Lippincott
/
LaunchTrick
/
install.cp
< prev
next >
Wrap
Text File
|
1994-06-25
|
623b
|
31 lines
#include <osutils.h>
#include <traps.h>
#include <files.h>
#include <resources.h>
#include <memory.h>
void main()
{
long oldTrap = GetOSTrapAddress( _HFSDispatch );
Handle resource = GetResource( 'Trik', 128 );
if ( resource == 0 )
return;
*(long *)(*resource + 0x30) = oldTrap;
*(long *)(*resource + 0x4A) = oldTrap;
*(long *)(*resource + 0x6A) = oldTrap;
unsigned long size = GetHandleSize( resource );
Ptr patch = NewPtrSys( size );
if ( patch == 0 )
return;
BlockMove( *resource, patch, size );
FlushDataCache();
FlushInstructionCache();
SetOSTrapAddress( long(patch), _HFSDispatch );
}